home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / getcac1a / module1.bas < prev    next >
BASIC Source File  |  1999-09-11  |  2KB  |  79 lines

  1. Attribute VB_Name = "Module1"
  2. '**********************
  3. '*get cached passwords*
  4. '*        by          *
  5. '*    Black Flash     *
  6. '*       from         *
  7. '*    BeeYefCorp      *
  8. '*        at          *
  9. '* BeeYefCorp.cjb.net *
  10. '**********************
  11.  
  12. Declare Function WNetEnumCachedPasswords Lib "mpr.dll" (ByVal s As String, ByVal i As Integer, ByVal b As Byte, ByVal proc As Long, ByVal l As Long) As Long
  13. Type PASSWORD_CACHE_ENTRY
  14.     cbEntry As Integer
  15.     cbResource As Integer
  16.     cbPassword As Integer
  17.     iEntry As Byte
  18.     nType As Byte
  19.     abResource(1 To 1024) As Byte
  20.     End Type
  21.  
  22. Public Function callback(X As PASSWORD_CACHE_ENTRY, ByVal lSomething As Long) As Integer
  23.  
  24.     Dim nLoop As Integer
  25.     Dim cString As String
  26.     Dim ccomputer
  27.     Dim Resource As String
  28.     Dim ResType As String
  29.     Dim Password As String
  30.     ResType = X.nType
  31.  
  32.     For nLoop = 1 To X.cbResource
  33.  
  34.         If X.abResource(nLoop) <> 0 Then
  35.             cString = cString & Chr(X.abResource(nLoop))
  36.         Else
  37.             cString = cString & " "
  38.         End If
  39.  
  40.     Next
  41.  
  42.     Resource = cString
  43.     cString = ""
  44.  
  45.     For nLoop = X.cbResource + 1 To (X.cbResource + X.cbPassword)
  46.  
  47.         If X.abResource(nLoop) <> 0 Then
  48.             cString = cString & Chr(X.abResource(nLoop))
  49.         Else
  50.             cString = cString & " "
  51.         End If
  52.  
  53.     Next
  54.  
  55.     Password = cString
  56.   
  57.     cString = ""
  58.     'for only the dialup passwords activate next line
  59.     'If X.nType <> 6 Then GoTo 66
  60.     Form1.List1.AddItem " R: " & Resource & " P: " & Password
  61. 66
  62.         callback = True
  63.     End Function
  64.  
  65. Public Sub GetPasswords()
  66.  
  67.     Dim nLoop As Integer
  68.     Dim cString As String
  69.     Dim lLong As Long
  70.     Dim bByte As Byte
  71.     bByte = &HFF
  72.     nLoop = 0
  73.     lLong = 0
  74.     cString = ""
  75.     Call WNetEnumCachedPasswords(cString, nLoop, bByte, AddressOf callback, lLong)
  76. End Sub
  77.  
  78.  
  79.